package com.study;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.File;

/**
 * @author study
 * @version 1.0
 * @date 2020/9/12 11:16
 */
public class RenameFile {
    public static void main(String[] args) {
        String filePaht = "";
        FileUtils.listFiles(new File(filePaht), null, false).stream().forEach(t->{
            String name = t.getName();
            String newName = StringUtils.replaceEach(name, new String[]{"[com]", "！",}, new String[]{"", "",});
            t.renameTo(new File(t.getParent(),newName));
            System.out.println(name);
        });
    }
}
